package com.tang.sink.custom;

import org.apache.flink.api.connector.sink2.StatefulSink;
import org.apache.flink.core.io.SimpleVersionedSerializer;

import java.io.IOException;
import java.util.Collection;

/**
 * 新版本SinkTo的自定义
 *
 * @author tang
 * @since 2023/6/9 18:11
 */
public class SinkToCustom<In> implements StatefulSink<In, String> {
    
    /**
     * Create a {@link StatefulSinkWriter}.
     *
     * @param context the runtime context.
     * @return A sink writer.
     * @throws IOException for any failure during creation.
     */
    @Override
    public StatefulSinkWriter<In, String> createWriter(InitContext context) throws IOException {
        return null;
    }

    /**
     * Create a {@link StatefulSinkWriter} from a recovered state.
     *
     * @param context        the runtime context.
     * @param recoveredState
     * @return A sink writer.
     * @throws IOException for any failure during creation.
     */
    @Override
    public StatefulSinkWriter<In, String> restoreWriter(InitContext context, Collection<String> recoveredState) throws IOException {
        return null;
    }

    /**
     * Any stateful sink needs to provide this state serializer and implement {@link
     * StatefulSinkWriter#snapshotState(long)} properly. The respective state is used in {@link
     * #restoreWriter(InitContext, Collection)} on recovery.
     *
     * @return the serializer of the writer's state type.
     */
    @Override
    public SimpleVersionedSerializer<String> getWriterStateSerializer() {
        return null;
    }
    
    
    
}
